﻿@model IEnumerable<MatchPlayResult>

<table class="table table-hover">
    <tr>
        <th>dato</th>
        <th>match</th>
        <th>resultat</th>
        <th></th>
    </tr>
    @foreach (MatchPlayResult r in Model)
    {
        <tr>
            <td>
                <span class="hidden-xs hidden-sm">
                    @r.Date.ToLongDateString()
                </span>
                <span class="hidden-md hidden-lg">
                    @r.Date.ToShortDateString()
                </span>
            </td>
            <td>@r.Player1.DisplayName vs. @r.Player2.DisplayName</td>
            <td>
                @if (@r.HolesUp == 0)
                {
                    <text>A/S</text>
                }
                else
                {
                    <span class="hidden-xs hidden-sm">
                        @r.WinningPlayer.DisplayName
                    </span>
                    <span class="hidden-md hidden-lg">
                        @r.WinningPlayer.Initials
                    </span>
                    @Html.Raw(string.Format("vandt {0}UP", r.HolesUp))
                }

            </td>
            <td>
                @if (r.Date < DateTime.Now.AddDays(-3))
                {
                    // cannot delete
                }
                else
                {
                    @Html.ActionLink("slet", "Delete", "Matchplay", new { id = r.Id }, null)
                }
            </td>
        </tr>
    }
</table>